# Build stage
FROM node:16.15.1 AS build
# node16以后docker打包必须指定工作目录
WORKDIR /usr/app
COPY ./ .
RUN npm install -g yarn
RUN yarn -i
RUN npm run build:prod

# Nginx stage
FROM nginx
MAINTAINER dengjk
WORKDIR /usr/app
COPY ./ .
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime &&echo 'Asia/Shanghai' >/etc/timezone
COPY --from=build /usr/app/dist/ /usr/share/nginx/html/
COPY dist/ /usr/share/nginx/html/
COPY dist/ /usr/share/nginx/html/ops/
EXPOSE 80
